tvr_derivative Function

public function tvr_derivative(dt, x, alpha, maxiter, tol, use_sparse, niter) result(rst)

Computes an estimate to the derivative of an evenly-sampled data set using total variation regularization.

This implementation solves the augmented dense formulation using an integration matrix and a first-difference regularization operator. The dense formulation uses the physical time step in its difference matrix and allocates dense matrices whose storage grows quadratically with the number of samples.

When use_sparse is true, this routine dispatches to tvr_derivative_sparse. That solver uses a different data-fitting term, a second-difference operator, physical curvature scaling, and normalized IRLS weights. Consequently, alpha values are solver-specific and should not be compared directly.

See Also

  • van Breugel, Floris & Brunton, Bingni & Kutz, J.. (2020). Numerical differentiation of noisy data: A unifying multi-objective optimization framework.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: dt

The time step between data points.

real(kind=real64), intent(in), dimension(:) :: x

An N-element array containing the data whose derivative is to be estimated.

real(kind=real64), intent(in) :: alpha

The regularization parameter.

integer(kind=int32), intent(in), optional :: maxiter

The maximum number of iterations to allow. The default is 20 iterations.

real(kind=real64), intent(in), optional :: tol

The convergence tolerance to use. The tolerance is applied to the change in the update measure. The dense solver uses an absolute Euclidean norm, while the sparse solver uses a relative Euclidean norm. The default is 1e-3.

logical, intent(in), optional :: use_sparse

True if the sparse solver should be used vs. the dense solver. This is highly recommended when N is larger than ~1000. The default is true such that the sparse solver is used. The sparse solver has linear storage growth and is preferred for large data sets.

integer(kind=int32), intent(out), optional :: niter

The number of iterations actually performed.

Return Value real(kind=real64), allocatable, dimension(:)

An N-element array containing the estimate of the derivative.